import time
import pytest


class Test_aaa():
    @pytest.fixture(scope="function", autouse=True)
    def open_home(self, request):
        print("function：%s \n--------回到首页--------" % request.function.__name__)

    #当open_home这个fixture设置为autouse=True相当于把这个fixture传给了test_01，test_02
    def test_01(self):
        print('-----------用例01--------------')

    def test_02(self):
        print('-----------用例02------------')

if __name__ == "__main__":
    pytest.main(["-vs", "autouse=True用法.py"])
